/*
 * Copyright (c) 2010-2011 Plugger Antonio Begue Ponce. All Rights Reserved.
 *
 * This file is part of Plugger Framework.
 *
 *  Plugger Framework is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License version 3 as published by
 *  the Free Software Foundation.
 *
 *  Plugger Framework is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Plugger Framework.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.plugger.infrastructure.rules;

import java.util.List;

/**
 * This static helper class validate a collection of rules and add all broken rules to a list.<BR/>
 * This help determine the broken rules of an entity.
 *
 * @author Antonio Begue
 * $Revision: 1.0 $
 */
public class ValidateRulesHelper {
    /**
     * A static function thar check all rules in rulesToCheck and add all broken rules to brokenRules.
     * @param brokenRules A collection to fill with broken IRules.
     * @param rulesToCheck A collection of IRules to check.
     */
    public static void collectBrokenRules(List<IRule> brokenRules, List<IRule> rulesToCheck) {
        for (IRule rule : rulesToCheck) {
            if (!rule.isValid()) {
                brokenRules.add(rule);
            }
        }
    }
}
